package jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class JDBCDemo2 {
    public static void main(String[] args) {
        try (
            Connection connection = DBUtil.getConnection();
        ){
            Statement state = connection.createStatement();
            String sql = "INSERT INTO student1(name,age,class_id) "+
                    "     VALUES('张三',12,1) ";
            int count = state.executeUpdate(sql);
            if(count>0){
                System.out.println("影响了表中"+count+"条数据");
            }
            System.out.println("执行完毕");

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
